package com.example.pceb.utils;

import org.springframework.stereotype.Component;

import java.io.File;

@Component
public class PathUtils {
    // 确保路径标准化
    public static String normalizePath(String path) {
        if (path == null || path.isEmpty()) {
            return "";
        }

        // 替换正斜杠为系统分隔符
        path = path.replace("/", File.separator);
        path = path.replace("\\", File.separator);

        // 确保以分隔符结尾
        if (!path.endsWith(File.separator)) {
            path += File.separator;
        }

        return path;
    }
}
